<template>
    <div class="shop-info">
        <span class="logo">
            <img :src="shop.logo" alt="">
        </span>
        <span class="name">{{shop.name}}</span>
        <div class="comment">
            <ul>
                <li class="sells">
                    <span>{{shop.sells | countFilter}}</span>
                    <span>总销量</span>
                </li>
                <li class="goods">
                    <span>{{shop.goods}}</span>
                    <span>全部宝贝</span>
                </li>
                <li class="pingjia"> 
                    <p v-for="item,index in shop.score" :key="index">
                        <span>{{item.name}}</span>
                        <span :class="{scoreActive: item.isBetter}">{{item.score}}</span>
                        <span :class="{height: item.isBetter}">{{item.isBetter ? '高' : '低'}}</span>
                    </p>
                </li>
            </ul>
        </div>
        <div class="button">
            <span>进店逛逛</span>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        shop: {
            type: Object,
            default() {
                return {}
            }
        }
    },
    filters: {
        countFilter(value) {
            let result = 0
            if (value > 10000) {
                result = (value / 10000).toFixed(1) + '万'
            } else {
                return value
            }
            return result
        }
    },
}
</script>


<style scoped>
    .shop-info{
        padding: 30px 0;
        margin: 30px 0;
        border-top: 6px solid #eee;
        border-bottom: 6px solid #eee;
    }
    .shop-info .logo{
        display: inline-block;
        width: 40px;
        height: 40px;
        margin: 0 6px;
        
    }
    .shop-info .logo img{
        width: 100%;
        border: 1px solid #eee;
        border-radius: 50%;
        vertical-align: middle;
    }

    .comment{
        margin: 24px 0 30px;
    }
    
    .comment ul{
        display: flex;
        justify-content: space-around;
        align-items: center;
        text-align: center;
        color: #333;
    }

    .comment ul li{
        display: flex;
        flex-direction: column;
        /* flex: 1; */
    }

    /* .comment ul .pingjia{
        flex: 2;
    } */

    .comment ul li:nth-child(3) p:nth-child(2){
        margin: 8px 0;
    }

    .comment ul .sells span,
    .comment ul .goods span{
        margin-bottom: 8px;
    }

    .comment ul li p:nth-child(2) span:nth-child(2){
        margin: 0 16px;
    }

    .comment ul li p span:nth-child(2){
        margin: 0 6px;
        color: green;
    }

    .comment ul li p span:nth-child(3){
        background: green;
        color: #fff;
    }

    .comment ul .goods{
        border-right: 1px solid #eee;
        padding-right: 30px;
    }

    .button{
        text-align: center;
        
    }

    .button span{
        background: #eee;
        padding: 8px 50px;
        border-radius: 10px;
    }

    .comment ul li p span.scoreActive{
        color: red;
    }

    .comment ul li p span.height{
        background: rgba(227, 7, 7, 0.842);
        color: #fff;
    }
</style>